
from wrappers import Turtle
# KEA 2004-08-08
# workaround for Mac not updating display until idle
import wx

def draw(canvas):
    # top left corner is 0,0 and bottom right is some positive x and positive y
    # so the coordinate space is not like a Logo turtle where 0,0 is the center
    # of the screen

    # these are returning the screen dimensions, not the width of the dc
    #print dc_local.GetSize()
    #print dc_local.GetSizeTuple()
    #print dc_local.GetClippingBox()

    t1 = Turtle(canvas)
    # background is shared among all turtles
    t1.setBackColor('black')
    t1.color('red')
    t1.showTurtle()
    t1.turtleDelay(1)
    t1.cls()  # get rid of any previous drawing
    
    t2 = Turtle(canvas)
    t2.color('green')
    t2.showTurtle()
    t2.width(2)
    t2.left(120)
    
    t3 = Turtle(canvas)
    t3.color('blue')
    #t3.showTurtle()
    t3.width(3)
    t3.left(240)

    t1.forward(50)
    t2.forward(50)
    t3.forward(50)
    # for loop below is equivelant, need a better way of doing
    # index range though
    nList = ['1', '2', '3']
    for i in nList:
        eval('t' + i + '.pu()')
        eval('t' + i + '.forward(50)')
        eval('t' + i + '.pd()')
    # KEA 2004-08-08
    # workaround for Mac not updating display until idle
    if wx.Platform == '__WXMAC__':
        canvas.redraw()

    tList = [t1, t2, t3]
    for i in range(6):
        [t.fd(80) for t in tList]
        # huge delay so we can see the turtle
        #for j in range(1000000): pass
        [t.rt(60) for t in tList]
        # huge delay so we can see the turtle
        #for j in range(1000000): pass
        # KEA 2004-08-08
        # workaround for Mac not updating display until idle
        if wx.Platform == '__WXMAC__':
            canvas.redraw()
    
